-
Notifications
You must be signed in to change notification settings - Fork 221
[skyrl-train] Refactor TIS to use more comprehensive off policy correction config #849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…out_correction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the Truncated Importance Sampling (TIS) configuration into a more comprehensive rollout_correction system, which is a great improvement for structure and extensibility. The new implementation adds flexible rollout correction mechanisms, including different TIS ratio types and rejection masks. The changes are well-documented and handle the deprecation of old parameters gracefully. I've identified a bug in a conditional check that could cause a crash, and an opportunity to refactor for better efficiency and code clarity. My detailed feedback is in the comments below.
…kyRL into rollout_correction
… unite metrics under loss_metrics, other clean up
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a significant refactoring of the off-policy correction mechanism, replacing the simple TIS flags with a more comprehensive off_policy_correction configuration. This is a great improvement for flexibility and experimentation. The changes are well-implemented across the codebase, including documentation, examples, and tests. I've identified a few critical bugs in the implementation and some areas for improvement in the examples and utility functions to enhance clarity and correctness. Please see the detailed comments below.
skyrl-train/examples/flash_rl/run_dapo_gsm8k_flashrl_0.5b_fp8.sh
Outdated
Show resolved
Hide resolved
skyrl-train/examples/flash_rl/run_dapo_gsm8k_flashrl_0.5b_int8.sh
Outdated
Show resolved
Hide resolved
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a significant and well-executed refactoring of the off-policy correction mechanism. Moving from a simple TIS flag to a comprehensive off_policy_correction configuration block is a major improvement in flexibility and power. The introduction of the LossMetrics TypedDict is a great step towards better type safety and code clarity. The changes are consistently applied throughout the codebase, including documentation, examples, and tests, which is commendable. The new tests for the off-policy correction logic are particularly thorough. I have a couple of suggestions regarding a hardcoded path in an example script and a potential bug in the distributed strategy logic, which I've detailed in the comments.
Overview
trainer.algorithm.use_tisandtrainer.algorithm.tis_imp_ratio_capfor deprecationtrainer.algorithm.off_policy_correctionconfig (see new config below)LossMetricsTypedDict containing loss metrics (previously returned just loss, clip_ratio)Off Policy Correction Config